<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

</head>
<body>
    <div id="app">
        <label >ID: <input type="text" v-model="id"></label>
        <label > name: <input type="text" v-model="name"></label>
        <button @click="add">add</button>
        <p v-for="item in list" :key="item.id">
            <input type="checkbox" >{{item.id}}--{{item.name}}
        </p>
    </div>
    <script src="../node_modules/vue/dist/vue.js"></script>
    <script>
        var vm=new Vue({
            el:"#app",
            data(){  
                return {
                    id:"",
                    name:"",
                    list:[
                        {id:1,name:'张无忌'},
                        {id:2,name:'赵敏'},
                        {id:3,name:'周芷若'},
                        {id:4,name:'宋青书'},
                    ]
                }
            },
            methods:{
                add(){
                    this.list.unshift({id:this.id,name:this.name})
                }
            }
        })
    </script>
</body>
</html>